import { useState } from "react";

const ButtonsEl = ({ reverse = false }) => {
  const [isReverse, setIsReverse] = useState(reverse);

  let btns = [
    <button
      key={1}
      onClick={() => {
        setIsReverse(!isReverse);
      }}
    >
      按钮1
    </button>,
    <button
      key={2}
      onClick={() => {
        setIsReverse(!isReverse);
      }}
    >
      按钮2
    </button>,
  ];
  return (
    <>
      <div>{isReverse ? btns.reverse() : btns}</div>
    </>
  );
};

export default ButtonsEl;
